<g:each in="${Projects.keySet().sort{it}}" var="project">
<div class="project" id="expressionFor${project}">
  <div class="table">
    <div id="cell-headline" class="line">
                    <div class="cellline">Cell Line <br/>(${Projects[project].name})</div>
                    <div class="expression">Expression Intensity</div>
                    <div class="uniquePep">Unique Peptides</div>
                    <div class="specCount">Spectral Count</div>
    </div>

    <div class="list" id="list">
      <g:each in="${AllCelllines[project].cls.keySet().sort{it}}" var="classes">
        <g:each in="${AllCelllines[project].cls[classes].celllines.keySet().sort{it}}" var="cellline">
          <g:if test="${AllCelllines[project].cls[classes].celllines[cellline].show}">
            <div class="line">
              <div class="cellline">${AllCelllines[project].cls[classes].celllines[cellline].name}</div>
              <div class="expression">${Projects[project].cls[classes].celllines[cellline].intensity.toInteger()}</div>
              <div class="uniquePep">${Projects[project].cls[classes].celllines[cellline].unique}</div>
              <div class="specCount">${Projects[project].cls[classes].celllines[cellline].msmsCount}</div>
            </div>
          </g:if>
          <g:else>
            <div class="line nullLine">
              <div class="cellline">${AllCelllines[project].cls[classes].celllines[cellline].name}</div>
            </div>
          </g:else>
        </g:each>
      </g:each>
    </div>

    <div class="line footline">
      <g:link action="downloadProteinExpression" params="${[id:Download, project:project]}" class="element download button" target="_blank">Download Table</g:link>
    </div>
  </div>

  <div class="plot" id="proj${project}Expr">
          <g:set var="range" value="${Math.pow(10,(Math.floor(Math.log10(Projects[project].max))-1))}" />
          <g:set var="rangeNo" value="${(Math.ceil(Projects[project].max/range)+1)}" />
          <g:set var="Scale" value="${(rangeNo*range)/100}"/>
    <div id="cell-headline" class="line">
                    <div class="cellline">Protein Expression Plot</div>
                    <g:if test="${Projects[project].nrCelllines!=AllCelllines[project].nrCelllines}">
                      <div class="showZeroExpression">
                        <div class="button" id="showZero${project}" onclick="showZero(${project});">Hide Missing</div>
                      </div>
                    </g:if>
    </div>
    
    <div class="list" id="list" nn="${Projects[project].nrCelllines}" wn="${AllCelllines[project].nrCelllines}" style="height:${AllCelllines[project].nrCelllines*24}px;">
      <g:set var="clsTop" value="${0}" />
      <g:set var="clsTopWN" value="${0}" />
      <g:each in="${AllCelllines[project].cls.keySet().sort{it}}" var="classes">
        <g:if test="${AllCelllines[project].cls[classes].show}">
          <div class="cls" nnp="${clsTop}" wnp="${clsTopWN}" nns="${Projects[project].cls[classes].celllines.size()}" wns="${AllCelllines[project].cls[classes].celllines.size()}" style="height:${AllCelllines[project].cls[classes].celllines.size()*24}px;top:${clsTopWN}px;">
            <g:set var="clsTop" value="${clsTop+(Projects[project].cls[classes].celllines.size()*24)}" />
            <g:set var="top" value="${0}" />
            <g:set var="topWN" value="${0}" />
            <g:each in="${AllCelllines[project].cls[classes].celllines.keySet().sort{it}}" var="cellline">
              <g:if test="${AllCelllines[project].cls[classes].celllines[cellline].show}">
                <div class="line" nn="${top}" wn="${topWN}" style="top:${topWN*24}px;width:${(Projects[project].cls[classes].celllines[cellline].intensity/Scale)}%; background-color:${Colors[Projects[project].cls[classes].name]}">
                  <div class="linelabel">${Projects[project].cls[classes].celllines[cellline].intensity.toInteger()}</div>
                </div>
                <g:set var="top" value="${top + 1}" />
              </g:if>
              <g:set var="topWN" value="${topWN + 1}" />
            </g:each>
            <g:if test="${Projects[project].cls[classes].celllines.size()>1}">
              <div class="avg" style="left:${Projects[project].cls[classes].avg/Scale}%;"></div>
            </g:if>
          </div>
        </g:if>
        <g:set var="clsTopWN" value="${clsTopWN+(AllCelllines[project].cls[classes].celllines.size()*24)}" />
      </g:each>
      <g:if test="${Projects[project].cls.size()>1}">
        <div class="avgAll" style="left:${Projects[project].avg/Scale}%"></div>
      </g:if>
    </div>
    <div id="scala">
        <g:each in="${0..rangeNo}">
          <div class="scala<g:if test="${(it%5==0)||(it==rangeNo)}"> bold</g:if>" style="left:${(100*it)/rangeNo}%;"><g:if test="${(it%10==0)||(it==rangeNo)}"><div class="desk">${it}</div></g:if></div>
        </g:each>
    </div>
    <div class="scalaLabel">Expression Intensity [x 10<sup>${Math.log10(range).toInteger()}</sup>]</div>
  </div>
</div>
</g:each>
<script type="text/javascript">proteinExpressionInit();</script>